<?php

use Qiniu\Auth;
use Qiniu\Storage\BucketManager;

class IndexController extends Yaf_Controller_Abstract {
    /* default action */
    public function indexAction() {
    	header("Content-Type:text/html; charset=utf-8");
        $code = $_GET['code'];

        print('<body bgcolor="#000000">');
        echo ("<P>start.</P>");
        echo $code;
        echo ("<P>end.</P>");
   }

//    public function deleteQiniuAction()
//    {
//        $config = Yaf_Registry::get('config');
//
//        $bucket_a = $config['bucket_name']['match_a'];
//        $bucket_b = $config['bucket_name']['match_b'];
//
//        $accessKey = $config['access_key'];
//        $secretKey = $config['secret_key'];
//        $auth = new Auth($accessKey, $secretKey);
//        $bucketManager = new BucketManager($auth);
//        $prefix = '';
//        $marker = '';
//        $limit = 1000;
//        $delimiter = '';
//
//        echo $bucket_a;
//        echo $prefix;
//        echo $marker;
//        echo $delimiter;
//        list($ret, $err) = $bucketManager->listFiles($bucket_a);
////        if ($err != null) {
////            echo "\n====> list file err: \n";
////            var_dump($err);
////        } else {
//        foreach ($ret as $item)
//        {
//            $bucketManager->delete($bucket_a, $item['key']);
//        }
//
////        }
//
//
//        list($ret, $err) = $bucketManager->listFiles($bucket_b);
//        foreach ($ret as $item)
//        {
//            $bucketManager->delete($bucket_b, $item['key']);
//        }
//
////        if ($err === null) {
////            var_dump($ret);
////            $ops = $bucketManager->buildBatchDelete($bucket_b, $ret);
////            list($ret, $err) = $bucketManager->batch($ops);
////            if ($err) {
////                print_r($err);
////            } else {
////                print_r($ret);
////            }
////        }
//    }
}
?>
